
// 在Vue组件中使用import.meta.glob
import { defineAsyncComponent,markRaw } from 'vue';
// 使用import.meta.glob来匹配当前目录下所有的.vue文件
const modules =  import.meta.glob('@/components/LowCode/**/*.vue');
const obj = {};
for (const path in modules) {
    const componentPath = path.replace(/^\/src\/components\/LowCode\/(.*)\.vue$/, '$1').split('/');
    const componentName = componentPath[componentPath.length-1]
    const viewSrc =  modules[path];
    obj[componentName] = markRaw(defineAsyncComponent(viewSrc));
}
export const cmptConfig =  (pathName) =>{
    // console.log('---obj---', obj);
    
    // 修改首字母为大写
    let name = pathName.slice(0,1).toUpperCase()+pathName.slice(1)
    return obj[name]
}